import http from '/@lib/utils/http/request'
import { PostForm, PostQuery, PostVO } from './types'

export const ApiSysPost: any = {}

/**
 * 查询岗位列表
 */
ApiSysPost.page = (queryParam?: PostQuery): Promise<PageResult<PostVO[]>> => {
  return http.get('/sysPost/page', queryParam)
}

/**
 * 查询岗位详细
 * @param id
 */
ApiSysPost.getInfo = (id: string | number): Promise<PostVO> => {
  return http.get('/sysPost/getInfo/' + id)
}

/**
 * 新增岗位
 * @param data
 */
ApiSysPost.save = (data: PostForm) => {
  return http.post('/sysPost/save', data)
}

/**
 * 修改岗位
 * @param data
 */
ApiSysPost.update = (data: PostForm) => {
  return http.post('/sysPost/update', data)
}

/**
 * 删除岗位
 * @param id
 */
ApiSysPost.remove = (id: string | number | Array<string | number>) => {
  return http.post('/sysPost/remove/' + id)
}

/**
 * 根据部门ID 获取岗位选择框列表
 */
ApiSysPost.listOptionSelect = (deptId?: number): Promise<any> => {
  const params = {
    deptId: deptId
  }
  return http.get('/sysPost/listOptionSelect', params)
}

/**
 * 查询岗位列表
 */
// ApiPost.export = (queryParam?: PostQuery): Promise<any> => {
//   return http.download('/system/post/export', queryParam, `post_${new Date().getTime()}.xlsx`)
// }
